home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHD_ScoobyDoo.lha / WHD_ScoobyDoo / Install < prev    next >
Text File  |  2001-04-28  |  7KB  |  298 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Scooby and Scrappy Doo")
  5. (set #CFG_APPSLV  "SDHD")
  6. (set #CFG_APPGUI  "Scooby Doo")
  7. (set #CFG_APPVER  "R0401.1")
  8. (set #CFG_APPCOPY "2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             (working "Determining game version")
  58.  
  59.             (set #VT1 (getsum #VDATFILE))
  60.  
  61.             (set #VVERINFA 0)
  62.             (if (= #VT1 1104626703) (set #VVERINFA 1))
  63.         ))
  64.     ))
  65.  
  66.     (if (<> 1 (exists (tackon #VDATDIR "end.raw"))) (set #VVERINFA -1))
  67. ))
  68.  
  69. ;------------------------------------------------------------------------------------
  70. ; Make game data
  71. ;
  72. (procedure P_InstallGame (
  73.     ;
  74.     ; Set path to game data file
  75.     ;
  76.     (set #VDATFILE (tackon #VDATDIR "scrap.prg"))
  77.  
  78.     ;
  79.     ; Install data files if not found or unknown versions
  80.     ;
  81.     (P_SetVersionInfo)
  82.  
  83.     (if (<= #VVERINFA 0)(
  84.         ;
  85.         ; Tell user what is happening
  86.         ;
  87.         (message
  88.             (cat
  89.                 "\n\n\nThe installer will now create the game data files\n"
  90.                 "Plese insert your game disk into drive DF0:\n\n"
  91.                 "Click 'Proceed' when ready."
  92.             )
  93.         )
  94.  
  95.         ;
  96.         ; Call the extractor slave
  97.         ;
  98.         (working (cat "Creating data files in '" #VDATDIR "'"))
  99.  
  100.         (copyfiles
  101.             (prompt "Copying data file creation slave")
  102.             (help @copyfiles-help)
  103.             (source "ISlave")
  104.             (dest #VDESTDIR)
  105.             (nogauge)
  106.             (optional fail force)
  107.         )
  108.  
  109.         (set @execute-dir #VDESTDIR)
  110.         (run (cat "WHDLoad SLAVE=ISlave"))
  111.         (set @execute-dir #VOLDEXEDIR)
  112.  
  113.         (delete (tackon #VDESTDIR "ISlave") (optional force))
  114.     ))
  115.  
  116.     ;
  117.     ; Check the main data file was created and
  118.     ; that we know this version of the game
  119.     ;
  120.     (P_SetVersionInfo)
  121.  
  122.     (if (= 0 #VVERINFA)
  123.         (abort
  124.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  125.                     "The installer does not recognise the version of the\n"
  126.                     "game that you are trying to install.\n\n"
  127.                     "Please contact the author for further information\n"
  128.             )
  129.         )
  130.     )
  131.  
  132.     (if (= -1 #VVERINFA)
  133.         (abort
  134.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  135.                     "The installer could not extract the game data files.\n\n"
  136.                     "Please contact the author for further information\n"
  137.             )
  138.         )
  139.     )
  140. ))
  141.  
  142. ;------------------------------------------------------------------------------------
  143. ; Install WHDLoad slave program
  144.  
  145. (procedure P_InstallSlave (
  146.     (working "Installing slave program")
  147.  
  148.     ; copy slave program
  149.     (set #VT1 "Slave")
  150.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  151.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  152.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  153.  
  154.     (copyfiles
  155.         (prompt "Copying slave program")
  156.         (help @copyfiles-help)
  157.         (source #VT1)
  158.         (newname #CFG_APPSLV)
  159.         (dest #VDESTDIR)
  160.         (nogauge)
  161.         (optional fail force)
  162.     )
  163.  
  164.     ; see if the user wants to replace their icon
  165.     (set #VT1 (cat #CFG_APPGUI ".info"))
  166.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  167.         ; no icon exists, quietly copy one in
  168.         (set #VT2 1)
  169.     )(
  170.         ; icon exists, ask user if they want to overwrite it
  171.         (set #VT2
  172.             (askbool
  173.                 (prompt (cat "Do you want to replace the '" #CFG_APPGUI "' program icon (recommended) ?"))
  174.                 (default 1)
  175.                 (help @askchoice-help)
  176.             )
  177.         )
  178.     ))
  179.  
  180.     ; do we have a slave icon?
  181.     (if (= 1 (exists "Slave.inf"))(
  182.         ; copy slave icon, renaming to proper name along the way
  183.         (if (= 1 #VT2)(
  184.             (copyfiles
  185.                 (prompt "Copying slave program icon")
  186.                 (help @copyfiles-help)
  187.                 (source "Slave.inf")
  188.                 (newname #VT1)
  189.                 (dest #VDESTDIR)
  190.                 (nogauge)
  191.                 (optional nofail force)
  192.             )
  193.         ))
  194.     )(
  195.         ; no slave icon so we must have a GUI to install
  196.         (copyfiles
  197.             (prompt "Copying GUI program")
  198.             (help @copyfiles-help)
  199.             (source  "GUI")
  200.             (newname #CFG_APPGUI)
  201.             (dest #VDESTDIR)
  202.             (nogauge)
  203.             (optional fail force)
  204.         )
  205.  
  206.         (if (= 1 #VT2)(
  207.             (copyfiles
  208.                 (prompt "Copying GUI program icon")
  209.                 (help @copyfiles-help)
  210.                 (source  "GUI.inf")
  211.                 (newname #VT1)
  212.                 (dest #VDESTDIR)
  213.                 (nogauge)
  214.                 (optional nofail force)
  215.             )
  216.         ))
  217.     ))
  218. ))
  219.  
  220. ;================================================================================
  221. ;
  222. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  223. ;
  224.  
  225. ;
  226. ; Initialise
  227. ;
  228. (set @app-name #CFG_APPNAME)
  229. (set #VOLDEXEDIR @execute-dir)
  230. (set #VVERINFA -1)
  231. (set #VVERINFB -1)
  232. (set #VVERINFC -1)
  233. (set #VDESTDIR @default-dest)
  234.  
  235. ;
  236. ; Check settings
  237. ;
  238. (if    (<> @user-level 2)
  239.     (abort "You must select 'Expert' user level")
  240. )
  241.  
  242. (if    (< @installer-version 2818051)
  243.     (abort "This product requires at least version 43.3 of the Installer program")
  244. )
  245.  
  246. ;
  247. ; Check required programs are available
  248. ;
  249. (set #VP1 "WHDLoad")
  250. (P_CheckRun)
  251.  
  252. ;
  253. ; Welcome message
  254. ;
  255. (message "\n\nWelcome to the " #CFG_APPNAME " HD Installer"
  256.          "\n© " #CFG_APPCOPY " John Girvin/Halibut Software\n\n"
  257.          "Please read the documentation thoroughly "
  258.          "before attempting to use this installer!\n\n"
  259.          "This is release " #CFG_APPVER "\n\n"
  260.          "Click 'Proceed' to begin..."
  261. )
  262.  
  263. ;
  264. ; Get directory to install in
  265. ;
  266. (set #VDESTDIR
  267.     (askdir
  268.         (prompt "Where would you like the game installed?\n"
  269.                 "If you have an existing installation select that directory,\n"
  270.                 "otherwise create / select the directory to install the game into."
  271.         )
  272.         (help @askdir-help)
  273.         (default @default-dest)
  274.         (disk)
  275.         (newpath)
  276.     )
  277. )
  278. (set #VDESTDIR (expandpath #VDESTDIR))
  279. (set @default-dest #VDESTDIR)
  280. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  281.  
  282. ;
  283. ; Create the installation directories
  284. ;
  285. (P_InstallDirs)
  286.  
  287. ;
  288. ; Install the game data
  289. ;
  290. (P_InstallGame)
  291.  
  292. ;
  293. ; Install the slave
  294. ;
  295. (P_InstallSlave)
  296.  
  297. ;========================================================================================
  298. ;$VER: Scooby & Scrappy Doo Installer script R0401.1 © 2001 John Girvin/Halibut Software